<template>
    <div class="home-wrapper">
        <div class="flex-card">
            <div class="item">
                <div class="name">文章数</div>
                <div class="number">{{info.article}}</div>
            </div>
            <div class="item">
                <div class="name">用户数</div>
                <div class="number">{{info.user}}</div>
            </div>
            <div class="item">
                <div class="name">今日接口访问量</div>
                <div class="number">{{info.api}}</div>
            </div>
        </div>
    </div>
</template>

<script>
    export default {
        name: 'HomeIndex',
        data() {
            return {
                info: {}
            }
        },
        created() {
            this.getData()
        },
        methods: {
            async getData() {
                try {
                    const {data} = await this.$http.get('/v1/dataCount')
                    this.info = data
                } catch (e) {

                }
            }
        }
    }
</script>

<style lang="scss">
    .home-wrapper {
        .flex-card {
            display: flex;

            .item {
                background-color: #fff;
                padding: 20px 15px;
                border: 1px solid #eee;
                flex: 1;
                font-size: 20px;
                display: flex;
                align-items: center;
                justify-content: space-between;
                margin-right: 15px;
                height: 100px;
                &:last-child {
                    margin-right: 0;
                }

                .number {
                    font-size: 30px;
                }
            }
        }
    }
</style>
